package cn.rokhdelar.ams.management.mapper;

import cn.rokhdelar.ams.management.domain.po.SysRole;
import cn.rokhdelar.ams.management.domain.vo.AuthorityVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author rokhdelar
* @since  2024-10-02 13:56:45
*/
public interface SysRoleMapper extends BaseMapper<SysRole> {
    @Select("""
            select sa.*
                from sys_role r
                join sys_role_authority sra on r.id = sra.role_id
                join sys_authority sa on sa.id = sra.authority_id
                where r.id = #{roleId} and r.deleted=0 and sra.deleted=0 and sa.deleted=0;
            """)
    List<AuthorityVO> getAuthoritiesByRoleId(String roleId);
}
